// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-11-8

#ifndef __NET_RECV_H_COMMON_SERVLIB__
#define __NET_RECV_H_COMMON_SERVLIB__

#pragma once

#include "net_config.h"
#include "net_sockdata.h"
#include "net_overlapped.h"
#include "net_transmit.h"

namespace JoyServer
{

// WSARecv and WSARecvFrom use this class to post operations.
// m_recvData contains the memory buffer.
class CJoyRecvOverlapped : public CJoyOverlapped
{
public:
    CJoyTransmitData*   m_recvData;
    sockaddr_in m_fromAddr;
    int m_fromAddrLen;

    virtual void OnComletion(DWORD dwTransferred, DWORD err);
public:
    CJoyRecvOverlapped(CJoySockData* sockData, CJoyTransmitData* recvData);
    CJoyRecvOverlapped(CJoySockData* sockData, int bufLen);
    virtual ~CJoyRecvOverlapped();
};

} // namespace JoyServer

#endif  // __NET_RECV_H_COMMON_SERVLIB__